package com.example.com.daervideo.activitys;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;

import com.afollestad.materialdialogs.MaterialDialog;
import com.example.com.daervideo.R;

import me.goldze.mvvmhabit.utils.MaterialDialogUtils;

public abstract class DialogActivity extends AppCompatActivity {
    private MaterialDialog dialog;

    public void showDialog() {
        showDialog("请稍后...");
    }

    public void showDialog(String title) {
        if (dialog != null) {
            dialog.show();
        } else {
            MaterialDialog.Builder builder = MaterialDialogUtils.showCustomDialog(this, title, R.layout.dialog_simple_progress);
            dialog = builder.show();
        }
    }

    public void dismissDialog() {
        if (dialog != null && dialog.isShowing()) {
            dialog.dismiss();
        }
    }
}
